//
//  UIDevice+utils.h
//  storeapp
//
//  Created by huangyi on 12-12-7.
//  Copyright (c) 2012年 ios. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIDevice (utils)

@end

extern double availableMemory();

extern NSString* deviceWifiMAC();
extern NSString* deviceUniqueID();
extern BOOL removeDeviceUniqueID();
extern NSString* deviceAppleID();
extern NSString* deviceLanguageID();
extern NSString* deviceLocaleID();
extern NSString* deviceName();

extern BOOL deviceIsPad();
extern BOOL deviceIsPhone();
extern BOOL deviceIsRetina();
extern BOOL deviceIsJailbroken();
extern BOOL deviceIsSimulator();

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
/*
 if (SYSTEM_VERSION_LESS_THAN(@"5.0")) {
 code here
 }
 */

extern void DDLogInit();
extern void RunLoop(NSTimeInterval seconds);
extern void BackgroundTask(dispatch_block_t task);
extern void MainTask(dispatch_block_t code);
extern void QueueTask(dispatch_block_t code);

extern void deviceIsBusy(BOOL busy);
